package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

@Entity
public class Jjfainfo {
    private int jjfaId;
    private String fazt;
    private Date tjdate;
    private String fanr;
    private String khfk;
    private Client kh;
    private Xsjhinfo xsjh;

    @Id
    @Column(name = "jjfaId", nullable = false)
    public int getJjfaId() {
        return jjfaId;
    }

    public void setJjfaId(int jjfaId) {
        this.jjfaId = jjfaId;
    }

    @Basic
    @Column(name = "fazt", nullable = true, length = 20)
    public String getFazt() {
        return fazt;
    }

    public void setFazt(String fazt) {
        this.fazt = fazt;
    }

    @Basic
    @Column(name = "tjdate", nullable = true)
    public Date getTjdate() {
        return tjdate;
    }

    public void setTjdate(Date tjdate) {
        this.tjdate = tjdate;
    }

    @Basic
    @Column(name = "fanr", nullable = true, length = 50)
    public String getFanr() {
        return fanr;
    }

    public void setFanr(String fanr) {
        this.fanr = fanr;
    }

    @Basic
    @Column(name = "khfk", nullable = true, length = 50)
    public String getKhfk() {
        return khfk;
    }

    public void setKhfk(String khfk) {
        this.khfk = khfk;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Jjfainfo jjfainfo = (Jjfainfo) o;
        return jjfaId == jjfainfo.jjfaId &&
                Objects.equals(fazt, jjfainfo.fazt) &&
                Objects.equals(tjdate, jjfainfo.tjdate) &&
                Objects.equals(fanr, jjfainfo.fanr) &&
                Objects.equals(khfk, jjfainfo.khfk);
    }

    @Override
    public int hashCode() {
        return Objects.hash(jjfaId, fazt, tjdate, fanr, khfk);
    }

    @ManyToOne
    @JoinColumn(name = "khId", referencedColumnName = "client_id")
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @ManyToOne
    @JoinColumn(name = "xsjhId", referencedColumnName = "xsjhId")
    public Xsjhinfo getXsjh() {
        return xsjh;
    }

    public void setXsjh(Xsjhinfo xsjh) {
        this.xsjh = xsjh;
    }
}
